#include <iostream>
using namespace std;

int score(int a,int b,int c)
{
    return a+b+c;
}//求和函数
struct student
{
    string name;
    int Chinese;
    int Statistic;
    int English;
}stu[10] = {
   {"qing",1,2,10},{"fefni",70,38,90},
   {"fhu",29,49,64},{"dhff",38,67,75},
   {"yjnyn",85,73,87},{"vhri",82,86,48},
   {"hoynu",71,64,87},{"hdeu",87,52,90},
   {"dytb",98,62,81},{"dgtnth",80,90,95}};
   //定义学生信息
//求总分最高
int max()
{
    int max=0;
    int i;
    int n;
    for(i=0;i<10;i++)
    {
        int grade;
        grade=score(stu[i].Chinese,stu[i].Statistic,stu[i].English);
        if(grade>max)
        {
            max=grade;
            n=i;
        }
        
    }
    cout<<"学生"<<stu[n].name<<"的成绩最高为："<<max<<endl;
    
}
//求总分最低
int min()
{
    int min=100;
    int i;
    int m;
    for(i=0;i<10;i++)
    {
        int grade;
        grade=score(stu[i].Chinese,stu[i].Statistic,stu[i].English);
        if(grade<min)
        {
            min=grade;
            m=i;
        }
    }
    cout<<"学生"<<stu[m].name<<"的成绩最低为："<<min<<endl;
    
}
//求各科平均分数：
int average()
{
    float ave1=0;
    float ave2=0;
    float ave3=0;
    
    for(int i=0;i<10;i++)
    {
        ave1+=stu[i].Chinese;
        ave2+=stu[i].Statistic;
        ave3+=stu[i].English;

    }
    cout<<"语文单科平均成绩："<<float(ave1/10)<<endl;
    cout<<"数据单科平均成绩："<<float(ave2/10)<<endl;
    cout<<"英语单科平均成绩："<<float(ave3/10)<<endl;

}

int main()
{
    for(int i=0;i<10;i++)
    {
        cout<<"学生"<<stu[i].name<<"的总成绩："<<score(stu[i].Chinese,stu[i].Statistic,stu[i].English)<<endl;
    }
    average();
    max();
    min();
    
}